import '../../data/models/prompt_model.dart';
import '../../core/enums/app_enums.dart';
import 'package:flutter/material.dart';

/// 主页状态类 - Home State Class
/// 管理主页的所有状态数据
/// This class contains only state variables, no methods or business logic
/// 此类仅包含状态变量，不包含任何方法或业务逻辑
class HomeState {
  /// 搜索关键词 - Search keyword
  /// Used to store the current search term entered by user
  String searchKeyword = '';

  TextEditingController searchController = TextEditingController();

  /// 选中的标签 - Selected tags
  /// List of tags currently selected for filtering prompts
  List<String> selectedTags = [];

  /// 选中的分类 - Selected category
  /// Currently selected category for filtering prompts
  String selectedCategory = '';

  /// 排序类型 - Sort type
  /// Current sorting method for the prompt list
  SortType sortType = SortType.dateCreated;

  /// 视图模式 - View mode
  /// Current display mode (list or grid view)
  ViewMode viewMode = ViewMode.list;

  /// 是否显示搜索栏 - Show search bar
  /// Controls visibility of the search bar
  bool showSearchBar = false;

  /// 是否正在加载 - Is loading
  /// Indicates if data is currently being loaded
  bool isLoading = false;

  /// 选中的 Prompt ID 列表 - Selected prompt IDs
  /// List of prompt IDs selected in selection mode
  List<String> selectedPromptIds = [];

  /// 是否处于选择模式 - Is in selection mode
  /// Indicates if the app is in multi-selection mode
  bool isSelectionMode = false;

  /// 是否只显示收藏 - Show favorites only
  /// Filter to show only favorited prompts
  bool showFavoritesOnly = false;

  /// 所有 Prompt 列表 - All prompts list
  /// Complete list of all prompts loaded from storage
  List<PromptModel> prompts = [];

  /// 筛选后的 Prompt 列表 - Filtered prompts list
  /// List of prompts after applying filters and search
  List<PromptModel> filteredPrompts = [];

  /// 当前选中的页面 Key - Key of the currently selected page
  /// Identifier for the currently active page
  String currentPage = 'prompt_management'; // 默认页面 - Default page

  /// 底部导航当前索引 - Current index of bottom navigation
  /// Index of the currently selected bottom navigation tab
  /// 0: Prompt 管理 - Prompt Management
  /// 1: 社区分享 - Community Sharing
  /// 2: 团队管理 - Team Management
  /// 3: 我的 - My
  int tabIndex = 0;
}
